﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Collections.ObjectModel;
using MindFusion.Scheduling;
using System.Threading;

namespace DentistApplication
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        private Personel User;
        private string RoleName;

        public MainWindow(string login)
        {
            InitializeComponent();
            DatabaseHandler.connectToDatabase();

           // User = new Personel { id = 0, firstname = "Asia", lastname = "wis", id_role = 0, login = "wisienka", 
           //     password = "lala", Role = new Role { name="nieRecepcja"}};
           
            User = DatabaseHandler.getUser(login);
            RoleName = User.Role.name;

            if (RoleName.Equals("Recepcja"))
            {
                main_btConfiguration.Visibility = Visibility.Hidden;
                main_btPatientsFile.Visibility = Visibility.Hidden;
            }
            laLoggedAs.Content += User.firstname + " " + User.lastname;
        }

        private void main_bt_Timetable_Click(object sender, RoutedEventArgs e)
        {
            TimetableWindow tw = new TimetableWindow();
            tw.Show();
        }

        private void main_btPatientsFile_Click(object sender, RoutedEventArgs e)
        {
           // PatientFile pf = new PatientFile(null);
           // pf.Show(); 
            PatientFileWindow rw = new PatientFileWindow();
            rw.Show();
        }

        private void main_btWorkers_Click(object sender, RoutedEventArgs e)
        {
            MessageBox.Show("To należy do modułu admina! Nie ma tam jeszcze nikt dostępu");
        }

        private void main_btTurnOff_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }

        private void main_btRegistraction_Click(object sender, RoutedEventArgs e)
        {
            RegistrationWindow rw = new RegistrationWindow();
            rw.Show();
        }

        private void main_btLogOut_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
            new LoginWindow().Show();
        }
    }
}
            
          
       